<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script th:src="@{/layui/layui.js}" type="text/javascript"></script>
		<link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
		<style>
			.layui-form-select dl dd.layui-this {
				background-color: #1e9fff;
				color: #fff;
			}
		</style>
	</head>
	<body>
	<div class="layui-panel" style="padding: 8px;">
		<fieldset class="layui-elem-field layui-border-blue">
			<legend>搜索信息</legend>
			<form class="layui-form layui-form-pane" style="margin: 20px;">
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">操作类型</label>
						<div class="layui-input-inline">
							<select class="layui-select" name="type">
								<option value="" title="请选择"></option>
								<option value="0" >一般日志</option>
								<option value="1" >安全日志</option>
								<option value="2" >订单日志</option>
								<option value="3" >其他日志</option>
							</select>
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">操作人员</label>
						<div class="layui-input-inline">
							<input class="layui-input" type="text" name="user" autocomplete="off" />
						</div>
					</div>
					<div class="layui-inline">
						<div class="layui-input-inline">
							<a class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchBtn">
								<i class="layui-icon layui-icon-search"></i>
								搜索
							</a>
						</div>
					</div>
				</div>
			</form>
		</fieldset>
		<div>
			<table id="msgTable" lay-filter="msgTable"></table>
		</div>
	</div>

	<script id="switchState" type="text/html">
		<input type="checkbox" name="state" value="{{d.state}}"
			   lay-skin="switch" lay-text="已发送|未发送" lay-filter="checkstate" {{d.state==0?"checked":""}} />
	</script>
    <script>

        var $;
        layui.use(['table','form','layer','jquery'],function () {
            var table = layui.table;
			$ = layui.jquery;
			//setHeight();
            table.render({
                elem:'#msgTable',
                height:'full-160',
                page: {
                	theme:'#1e9fff'
				},
                url:'/system/olc/find',
                where:{
                    status:0
                },
                cols:[
                		[
                    {type:'numbers',fixed:'left'},
                    {type:'checkbox',fixed:'left'},
                    {field:'type',title:'日志类型',width:150,
						templet:function (res) {
							if("0" == res.type){return "<span style='color: #1e9fff'>一般日志</span>"}
							else if("1" == res.type){return "<span style='color: #f00'>安全日志</span>"}
							else if("2" == res.type){return "<span style='color: #008000'>订单日志</span>"}
							return "<span style='color: #000'>其他日志</span>";
						}
					},
                    {field:'user',title:'操作人',width:100},
					{field:'createTime',title:'操作时间',width:180},
					{field:'ip',title:'ip地址',width:200},
				    {field:'action',title:'操作动作',width:150},
					{field:'result',title:'操作结果',width:150},
					{field:'comment',title:'备注信息',minWidth:150}
                ]
				]
            });
        
        
        	table.on('toolbar(msgTable)',function(obj){
        		var event = obj.event;
        		if('add' == event){
        			var b = false;
        			top.layer.open({
        				title:'新增信息发送',
        				type:2,
        				content:'/page/system/sendMessageAdd',
        				area:['800px','600px'],
        				btn:['确定提交','取消关闭'],
        				btn1:function(i,o){
        					b = true;
        					o.find('iframe')[0].contentWindow.btnSubmit();
        				},
						end:function () {
							if(b) layui.table.reload('msgTable');
						}
        			})
        		}
        	});
        });
        
        //获取页面高度
		function setHeight(){
			var height = window.outerHeight-258;
			$('.layui-panel').css('height',height);
		}
    </script>
</body>

</html>
